$(function()
{
	$('.deletePub').click(function()
			{
				if(confirm("Are you sure?") == true)
				{
					$('.deletePub').removeClass('focus');
					$(this).addClass('focus');
					var deleteId = $('.focus').attr('id');
					$.post("deletePublication.php", {pubID : deleteId}, function(data)
					{
						if(data == "napsuvai")
						{
							alert("Ne mi sa pravi na mnogo ymen shtot shte ti eba pytkata maina pedal grozen!");
						}
						else
						{
							$("#duvar").load("mainFrame.php");
						}
					});
				}
			});
			$(".likeButton").click(function()
			{
				$(".likeButton").removeClass("focused");
				$(this).addClass("focused");
				var forLikeId = $(".focused").attr("id");
				$.post("likePub.php", {pubID : forLikeId}, function(data)
				{
					if(data == "napsuvai")
					{
						alert("Ne mi sa pravi na mnogo ymen shtot shte ti eba pytkata maina pedal grozen!");
					}
					else
					if(data == "Haresano")
					{
						alert("You have already liked this publication.");
					}
					else
					if(data == "fr")
					{
						alert("You can't like this publication.");
					}
					else
					{
						$("#duvar").load("mainFrame.php");
					}
				});
			});
			$(".dislikeButton").click(function()
			{
				$(".dislikeButton").removeClass("Thisfocused");
				$(this).addClass("Thisfocused");
				var forLikeId = $(".Thisfocused").attr("id");
				$.post("dislikePub.php", {pubID : forLikeId}, function(data)
				{
					if(data == "napsuvai")
					{
						alert("Ne mi sa pravi na mnogo ymen shtot shte ti eba pytkata maina pedal grozen!");
					}
					else
					if(data == "Haresano")
					{
						alert("You have already disliked this publication.");
					}
					else
					if(data == "fr")
					{
						alert("You can't dislike this publication.");
					}
					else
					{
						$("#duvar").load("mainFrame.php");
					}
				});
			});
});